package org.qiuer.func.function;

import org.qiuer.ast.INode;
import org.qiuer.ast.pattern.IPattern;
import org.qiuer.func.ANormalFunction;
import org.qiuer.run.Context;
import org.qiuer.exception.IException;

import java.util.List;

/**
 * 在js代码里，使用者自己写的通过function aaa() { ... } 定义的函数。
 */
public class UserDefineFunction extends ANormalFunction {
  public String type = "UserDefineFunction";

  public String name;

  @Deprecated
  public UserDefineFunction() {
  }

  public UserDefineFunction(String name, INode body, List<IPattern> params) {
    this.name = name;
    this.body = body;
    this.params = params;
  }

  @Override
  public void compile() throws IException {

  }

  @Override
  public Object run(Context context) throws IException {
    return super.run(context);
  }

  @Override
  public String getName() {
    return this.name;
  }
}